package app

import grails.core.GrailsApplication
import grails.plugins.*
import middol.utils.OfficeService
import org.apache.poi.util.IOUtils
import org.jodconverter.core.DocumentConverter
import org.springframework.beans.factory.annotation.Autowired

import javax.servlet.ServletOutputStream

class ApplicationController implements PluginManagerAware {

    GrailsApplication grailsApplication
    GrailsPluginManager pluginManager
//    NoticeService noticeService
//    UploadService uploadService
//    @Autowired
//    IndexesHandler indexesHandler
//    OfficeService officeService
    def index() {
        render '服务已经启动'
//        String from = "E:\\QMS一期工作说明书.docx"
//        String to = "E:\\fupload\\test.pdf"
//        officeService.previewPdf(from, to, response.getOutputStream())
//        response.setContentType("application/octet-stream")
//        response.setHeader("Content-disposition", "attachment;filename=${new String(outFile.getName().getBytes(), 'iso-8859-1')}")
//        response.outputStream << outFile.newInputStream()
//        EmailMessage emailMessage = [
//            type: "Email",
//            subject: "html测试邮件",
////                text: "测试邮件",
//            tos: ["zhangjiayu@middol.com", "943510713@qq.com"],
//            html: [view: "/email/Test", model: [test: "这只是一个测试"]]
//        ]
//        noticeService.sendNotice(emailMessage)
//        IFileInfo iFileInfo = [:]
//        uploadService.upload(iFileInfo)
//        def index = [
//                uid: "test2"
//        ]
//        indexesHandler.create(index)
//        render indexesHandler.getAll() as JSON
//        [grailsApplication: grailsApplication, pluginManager: pluginManager]
    }
}
